package com.ruyuan.token;

import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.realm.Realm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author xx
 */
@Component
public class TokenUtil {

    @Value("#{${realm.map}}")
    private Map<String, String> realmMap;

    public boolean supports(AuthenticationToken token, Realm realm) {
        return ((UsernamePasswordTypeToken)token).getType().equals(realmMap.get(realm.getName()));
    }


}
